# 移除数组中重复的元素
def remove_duplicates(num_list):
    # 这个数组用来统计每个数字出现的次数
    num_count_list = []
    for num in num_list:
        # 统计元素出现的次数
        num_count = num_list.count(num)
        # 封装成一个数组
        temp_num_count_list = [num, num_count]
        # 判断先前是否已经统计过此元素，只需要统计一次
        if temp_num_count_list not in num_count_list:
            num_count_list.append(temp_num_count_list)
    print(f'num_count_list[{num_count_list}]')
    # 开始移除 count > 1 的元素
    for num, count in num_count_list:
        if count > 1:
            while count > 1:
                count -= 1
                num_list.remove(num)
    return num_list


nums = [10, 10, 9, 9, 8, 8, 8, 1, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(f'origin{nums}')
print(f'after remove {remove_duplicates(nums)}')

nums = [10, 10, 10, 10, 10]
print(f'origin{nums}')
print(f'after remove {remove_duplicates(nums)}')

nums = []
print(f'origin{nums}')
print(f'after remove {remove_duplicates(nums)}')
